<?php
require_once 'AopSdk.php';

$input = file_get_contents("php://input"); //接收提交的所有POST数据
$postStr = urldecode($input);//对提交的POST数据解码

//构造参数
$aop = new AopClient ();

//测试环境 开始
//$aop->gatewayUrl = 'https://openapi.alipaydev.com/gateway.do';
//$aop->appId = '2016080700187833';
//$aop->rsaPrivateKey = 'MIIEpAIBAAKCAQEA2sxjlX1XDN4cFU5/kU3Ckmz5IsJRmL22YjGZYVLZPsEX5q+hMH0ZtaggtMd78RGh3fcGysibrEydBUA0KcrfVJE+vEIONCfE36pfpUg733LW3Eo+pRYAY9A1FajbtZkYuC8XyC6ckcgnoVQQCPxYQsE20FMRaMs/UKcH4b/wHRtqaQITbEkx/49FsDdeqj6hJE/9xh1utEiGkIagkbd92/NiXMBeGKqp48yR1gfEe6nKIElNgHvho8IqYU8p9d5pLnl3CNQ5O7aqJxFia83HT6QVCVvfL2wTVMLngwva2bWkv5d+1N4/IBCztt5xg6gUaEMbbpSPYcBu538gc4B6wQIDAQABAoIBADzEq5vnVfgS8EXSqYeXy0ST05Yd1j/P4QngsLLhKclOI+9ENEadWDil23+aMAhCV2yooVBM6z+tf6bnsBUzbVe1h3EN/5fou7tLPIlRSJ/E63v/euqq86zFNRkw7uS/AqiVG8vTdlTe/HLIQDPesjzIIQs3Jwyt9oXV/lBq2KucYBlT7rwwiQw/H8n9HnhEqR76zuWkreg/KerL4UI/O8yfZtyWlmxwVw07a7e/vSOEkT6q4usWMLHoEoxBLMotcXUvcu9w9x3nWA4gqjccNPSfXclrT+22x82QuKrLSo5M+F2vsrTCxzOCEe/i6W3C3+MGCsvejstfCF93jhuENeECgYEA9xDHtaTXMvr/58l2nmWA0voiA66Dg8y5Gb3XY8YxKz+U+CVN4UmU2UJN+0K9iEuW8I8l71wY/t3YCFQK+VIJbxulTU5KbOhqVy2Boqt6S5twlOMedwRXwFqn3IeGOpLW7Pk3LpBIZ+ntgD6dgQ63edx4YBPXyNPaCLb6yzhk650CgYEA4rXsrHtPmvsbOPsTx981chOCQKIAMz0c6RizLLtQywEGWdiFNQKFok8K2mCcDJq2xg5sAIeqTtB67v5VeXl3e19pIZ10Wy3hYQvylrbs1yOO+DhW32RIibXxNk7Bb995q4BkE8japOnHMxrMRU/Vb63ijzi9IcbkLjv+lipIPHUCgYAi65U+oEjmZMGs0jXY14Hoz//kw1LFWzdCYynBaW7jrP3yQNuMHylRt+Rrwhgl3oE8CQ+UkFDcHSD+tFpEuQqqUJ8BmTI9yG/XWJA9HL2RWCwGbz+MFOoOPwIA0orvVnfYULUy+KOzREYUXUVHy3u1VqsQ8V0Lfp4Po0U5WgQxpQKBgQDPJf+NUlbYe1zSYcgfNrp085JuUBfyuYJzEhiVZMpb0yHkcky0tQs51RNLmj673ZnnukHA8jURMrlBKq8bAXvFBNbg2if5MCDhNbOBNr+NjHYUJBZspAsLmW0/fBKPkBhyNiw7T6lISjuzXGcNZfbVxoJe7y8Rb9QK0tK6jwPWCQKBgQCfmIAcqebuWeR3722dXG851gY9TFOrMtxP2SCqTmRs7CyAefWgjleVh59pv/xK4tg0ic3hFHLwsQE0H5kA0FfP+DHhLrDvJhzYvpw5T54EJQy12mhEcB5kSUZ68h5GvsJo17FQU9+39lfqpP/pyXgCKnW0slfAcj0NsSjqwL9Qxw==';
//测试环境 结束

//正式环境 开始
$aop->gatewayUrl = 'https://openapi.alipay.com/gateway.do';
$aop->appId = '2017042606994321';
$aop->rsaPrivateKey = 'MIIEpAIBAAKCAQEA2sxjlX1XDN4cFU5/kU3Ckmz5IsJRmL22YjGZYVLZPsEX5q+hMH0ZtaggtMd78RGh3fcGysibrEydBUA0KcrfVJE+vEIONCfE36pfpUg733LW3Eo+pRYAY9A1FajbtZkYuC8XyC6ckcgnoVQQCPxYQsE20FMRaMs/UKcH4b/wHRtqaQITbEkx/49FsDdeqj6hJE/9xh1utEiGkIagkbd92/NiXMBeGKqp48yR1gfEe6nKIElNgHvho8IqYU8p9d5pLnl3CNQ5O7aqJxFia83HT6QVCVvfL2wTVMLngwva2bWkv5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K0tK6jwPWCQKBgQCfmIAcqebuWeR3722dXG851gY9TFOrMtxP2SCqTmRs7CyAefWgjleVh59pv/xK4tg0ic3hFHLwsQE0H5kA0FfP+DHhLrDvJhzYvpw5T54EJQy12mhEcB5kSUZ68h5GvsJo17FQU9+39lfqpP/pyXgCKnW0slfAcj0NsSjqwL9Qxw==';
//正式环境 结束

$aop->apiVersion = '1.0';
$aop->signType = 'RSA2';
$aop->postCharset= 'utf-8';
$aop->format='json';
$request = new AlipayTradePagePayRequest ();
$request->setReturnUrl('http://www.huimaoxiehui.com/account/payment-alipay');
$request->setNotifyUrl('http://bk.huimaoxiehui.com/mp/alipay');
//$request->setBizContent('{"product_code":"FAST_INSTANT_TRADE_PAY","out_trade_no":"20150320010101001","subject":"Iphone6 16G","total_amount":"88.88","body":"Iphone6 16G"}');
$request->setBizContent($postStr);
 
//请求
$result = $aop->pageExecute ($request); 
 
//输出
echo $result;